<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>
        是用户名：<input type="text" id="name">
    </p>
    <p>
        密码：<input type="password" id="pwd">
    </p>
    <p>
        <button id="btnLogin">登录</button>
    </p>
    <script src="./Scripts/jquery-3.7.0.min.js"></script>
    <script>
        $(function(){
            $('#btnLogin').click(function(){
                $.ajax({
                    url:'http://localhost:57010/api/account/login',
                    method:'post',
                    data:{
                        LoginName:$('#name').val(),
                        Password:$('#pwd').val()
                    },
                    success:function(res){
                        if (res.Success){
                            localStorage.setItem('user',res.Data);
                            //seesionStorage.setItem('user',res.Data);
                            location.href='/index.html'
                        }
                        alert(res.Msg);
                    }
                })


            })



        })

    </script>
</body>
</html>